#ifndef BRANCH_H
#define BRANCH_H

#include "BranchBase.h"
#include "GraphicsObject.h"
#include <QPen>

class GraphicsScene;
class Node;

class Branch : public GraphicsObject, public BranchBase
{
    Node * n1;
    Node * n2;
    QLineF line;
    int width;

    bool autoColor;

    QPen pen;

public:
    explicit Branch( Node * n1, Node * n2, GraphicsScene * scene );
    ~Branch();

    bool GetAutoColor() { return autoColor; }
    void SetAutoColor( bool c ) { autoColor = c; }

private:
    void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget );
    QPainterPath shape() const;
    QRectF boundingRect() const;

public:
    Node * Nd1() { return n1; }
    Node * Nd2() { return n2; }
    //void SetNd1( Node * n ) { n1 = n; }
    //void SetNd2( Node * n ) { n2 = n; }

    void SetWidth( int w ) { width = w; }
    int GetWidth() { return width; }

    void SetColor( QColor c );

    void UpdateParamStr();

private:
    QLineF mkLine();

};

#endif // BRANCH_H
